import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int m = scanner.nextInt();
        int n = scanner.nextInt();
        int[][] arr = new int[m][n];
        int[][] dp = new int[m + 2][n + 2];
        for(int i = 0; i < m; i++) {
            for(int j = 0; j < m; j++) {
                arr[i][j] =  scanner.nextInt();
            }
        }
        dp[0][1] = 1;
        for(int i = 1; i <= m; i++) {
            for(int j = 1; j <= n; j++) {
                if(ret(arr[i ][j ],arr[i - 1][j ]) == 1) {
                    dp[i][j] += dp[i - 1][j];
                }
                if(ret(arr[i ][j ],arr[i - 1][j - 2]) == 1) {
                    dp[i][j] += dp[i][j - 1];
                }
            }
        }

        for(int i = 1; i <= m; i++) {
            for(int j = 1; j <= n; j++) {
                dp[i][j] += (dp[i + 1][j] + dp[i][j + 1]);
            }
        }
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        System.out.println(dp[a][b]);
    }
    public static int ret(int a,int b) {
        if(Math.abs(a - b) <= 1) {
            return 1;
        }
        return 0;
    }
}
